package edu.vt.ece_3574.amber_alert.curfew;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import edu.vt.ece_3574.amber_alert.PrimaryMain;
import edu.vt.ece_3574.amber_alert.database.DatabaseHandler;

/**
 * Service to handle checking whether a mmeber has met their curfew
 * 
 * @author acorvin
 */
public class CurfewService extends Service {
	public void onCreate() { 
		//Set the currently selected account to the member that is selected for the curfew
		//TODO: This will result in a bug if a curfew is set for one member and then later for another member before the first curfew has passed.
			//We should instead implement some method to determine which member's curfew it is based on what time it is, or some other way
		super.onCreate();
		DatabaseHandler.get().handleCurfewLocation(null, PrimaryMain.selectedMember);
		onDestroy();
	}
	
	public void onDestroy() {
		super.onDestroy();
		stopSelf();
	}

	@Override
	public IBinder onBind(Intent intent) {
		return null;
	} 
}
